package com.bw.house.common.alipay;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {

//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

    // 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
    public static String app_id = "2016102600766123";

    // 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCJQGVjIzSHDpkaQkAEnvbsVXaxmRfraZFUNjM3zZND9rISm9k7fQ/LxRwT9jo5BHJ6o9Eu16jLmEvR5cRH5Rb6TCSi8UAYdhoLiDrXLxoaKjXcFNa21AqqFREWsiwL5gooUduyz5O8fl4xcGqWtPJDOTDaHmFTk9yseYn5CbM2AyGJlueCFHRQQmlAjJii5/FbxEQuDRIrmSncuzatRo4IrkTn6KT4RkSKJiRpVa7uR9HmmjQ3WLFV6zXQBw4CV6acDnu9+O0QoGoNitYcmos4AjRNno2pTtxcdTa1hEq1v+GFBkZlVcfPSXjMpwlzyqO205MlHFtZNzc6c2lS1yczAgMBAAECggEAIb6sbshsFLyZFeSt+rTevtJwYU/jmqSU76B3zUOE7pPLyll4+nBQHuhyc9H5FKWsQ8zdFGg/fvcNxSh5rrd7g8SOyWUJPjpjQuyWkutovoAcR+TzuXW+vXx6fBsIS1CetLUTkA4LI6/qFrut6SnJ2o9IHIiVo0faXKlxK8Kfxip3as67PQQ/gGkpWTTHwYNaeyKiu/h946LNY2sF5Z+lKhranazM+h4gNs+R8Z0j4AN4d7gcjWmS05zrt9BA5O8ykNed6n7sQQfA0LfwESrCFWQlLGXBzSKl8ojuSKoqAwRm6nWpUK15Ik0pqwu7rNZT0p44KbTcZWL/2d63z/nGoQKBgQDd4EKZWHkq7C7CATL9zt5kzRfKJX4ehBxNPRXlo34NE1zPIkkEIDQfggD0UND3SK6W7PKSZBk7muNko5O+6Wb3CEHgaTrT4APJiklm39tdUP1+kqdmOFIIA5U5i8oyocgiMWYlCbFGwVicvLK2sGVCZyYG8yhjxiqc6Q5A7aIuUQKBgQCeXEl8KWRvDOfi4meF6k9sdMppT1Gsvrh48Kq+w9IWYw4NddADHH96qwOzR0JMcxHj+Hxdh/gzB9oeWEkJRIDHueUwY3UM4KoSDiaOR8aUO7p9MWTnXhsUGhquaeP+zDIvCTKqwA6K0CoWgpw2yqwueJ6+YsabFm9biA5WB6qIQwKBgACaRVQJS3r0XUQloK/TygLYE8J2y5rlnPYQvmh7QzJh5RSi8TPTqpCTV9FSDt89EUxTpG0FXJQu3YM+dn5EQAVXvmYPoxtENn5ro7tlzEC6oZWgbFf4uzBOYi9f09LDYbnGDJL5LcQVblouoQWiAQRnJ1FJg8iRlzgJ4gIHIzOhAoGAEK9Wir9ttomckPobwC9MyPeRMAFMcK/zjcKFqu3E39j17RMhpIJHKCyGikgSwy1IkEVpDQ27Z90G7TWOFGzkSKbcb/m6pm2xXY+iHlGPqaSVZIVkxT/UCI0rjH7Zp8np66zDatwrbBK8rHx8awV1mLvateKAXGzDtNgj8oqCPDMCgYEAyIu6X6pLnkdDB/oigPevbY1fqW4VTDdT1lr8boDXAPY10ytuekDoNhIjs+9oXwEMLMWLHkUvN4aI36kK0urTeM+4mWZHIuoKQtyq4sDX+3XpCCQPdttbw+ZByW9EvNCNNfObrNLyZKucvZdq1OasgYIQ2s4O5sVjzYMp5kiSpOc=";

    // 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAmTujxUBIarj3bjeFwOXxedadFZpbmNOJFfDLlznoOIVZ7aMW4310KN6LsNe++PvlUoQqGJ9U18TzSHyTcuDjo+t+npEgwgHIR2D6ILK031dNMvAmsUItY9gpdtI3SS/yY9GMEcjpjuNolOHlmZmAG5Si4M5LWrmQ9aMJMMGTZ1LtE/fdLsCceLdAee1rHW/KOjHqE02mrtjYOv9HZ5GDjA0h8sDYLmch1MyXt5txcee6uDv23vg7pTxn00h3AZ63RitIqSJd7IX/JlN4braM018cTf/gXKVmGKYp07oY+kLddtqGWanO8GMtAvK6/WnC8RbXh4YT5Fibffpuf4Q6RwIDAQAB";

    // 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String notify_url = "http://localhost:8080/alipay.trade.page.pay-JAVA-UTF-8/notify_url.jsp";

    // 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String return_url = "http://localhost/payResult.html";

    // 签名方式
    public static String sign_type = "RSA2";

    // 字符编码格式
    public static String charset = "utf-8";

    // 支付宝网关
    public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";

    // 支付宝网关
    public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /**
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

